<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <form action="/user/add" method="post">
        <label>ID:</label>
        <input type="number" name="id">
        <label>姓名:</label>
        <input type="text" name="name">
        <label>年龄:</label>
        <input type="number" name="age">

        <input type="submit" value="保存">
    </form>

<script th:inline="javascript">
    var flag = [[${flag}]];

    if(flag=="success"){
        alert("保存成功");
        window.location.href="/user/list";
    }
</script>
</body>
</html>